<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label for="c-vip" class="control-label col-xs-12 col-sm-2">{:__('会员卡等级')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-vip" data-rule="required" class="form-control selectpicker"  data-live-search="true" name="row[vip]">
                {foreach $rows as $index=>$vo}
                <option data-type="type" value="{$vo.id}" {if condition="$vo.id==$row.vip"} selected{/if}>{$vo.name}</option>
                {/foreach}
            </select>

        </div>
    </div>


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button id="news" type="submit" class="btn btn-success btn-embossed">{:__('确认')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script src="/assets/img/jquery-3.4.1.min.js"></script>
<script>
    $('#news').click(function(){
        let vip = $('#c-vip option:selected').val();
        let id = {$row.id};

        $.ajax({
            url:"users/users/editss",    //请求的url地址
            dataType:"json",   //返回格式为json
            async:true,//请求是否异步，默认为异步，这也是ajax重要特性
            data:{"id":id,"vip":vip,},    //参数值
            type:"POST",   //请求方式
            success:function(data){
                //请求成功时处理
                if (data.code == 0) {
                    //console.log(data);
                    Toastr.error(data.msg);
                }else {
                    parent.Toastr.success(data.msg);
                    parent.$(".btn-refresh").trigger("click");
                    parent.Layer.closeAll();
                }
            },
        });
    })


</script>
